/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package file;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Vector;

/**
 *
 * @author joao
 */
public class PrintFile {

    private File file;
    private FileWriter ww;
    private String writer;
    //private BufferedWriter writer;

    public PrintFile(Vector<String> v) throws IOException {
      //  initFile();
        printFile(v);
    }

  
    private void printFile(Vector<String> v) {
        //try {
            //writer.write("");
            writer += "  ";
            for (int i = 0,  j = 0 ; i < v.size() * 2; i++, j++ ) {
                
                if (i % 4 == 0 && i != 0 ) {
                    writer += "\n ";
                    //writer.write("\n\n\n\n");
                    //writer.write( "" );
                }
                writer += "" + v.get(j);
                writer += "             ";
                writer += "" + v.get(j);
                i++;
                //writer.write(v.get(i));
                writer += "             ";
                // writer.write("  ");
            }
            // writer.close();
        //} catch (IOException ex) {
          //  Logger.getLogger(PrintFile.class.getName()).log(Level.SEVERE, null, ex);
        //}
    }
    
    public String getWriter(){
        return writer;
    }
}

/* Old method to print the protocols in files!
 *   private void initFile() {
        try {

            file = new File("//tmp/file");
            ww = new FileWriter(file, false);
      
            //writer = new BufferedWriter(ww);

        } catch (IOException ex) {
            Logger.getLogger(PrintFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
*/
